.line-chart {
  .chart-area{
    width: 100%;
    height: 100%;
  }
  .legend {
    display: flex;
    gap: 20px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);

    &.legend-top {
      order: 1;
    }

    &.legend-bottom {
      order: 3;
      border-bottom: none;
      border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    &.legend-left {
      flex-direction: column;
      width: 120px;
      padding: 20px 10px;
      border-bottom: none;
      border-right: 1px solid rgba(255, 255, 255, 0.1);
    }

    &.legend-right {
      flex-direction: column;
      width: 120px;
      padding: 20px 10px;
      border-bottom: none;
      border-left: 1px solid rgba(255, 255, 255, 0.1);
    }

    .legend-item {
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      transition: opacity 0.2s ease;

      &:hover {
        opacity: 0.8;
      }

      .legend-color {
        width: 12px;
        height: 12px;
        border-radius: 2px;
        flex-shrink: 0;
      }

      .legend-name {
        font-size: 12px;
        font-weight: 500;
        white-space: nowrap;
      }
    }
  }

  .chart-canvas {
    display: block;
    order: 2;
  }

  // 主题样式
  &.dark {
    background: linear-gradient(135deg, rgba(0, 18, 40, 0.95) 0%, rgba(0, 32, 63, 0.9) 100%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

    .legend {
      background: rgba(0, 18, 40, 0.7);
      border-color: rgba(255, 255, 255, 0.1);
    }
  }

  &.light {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);

    .legend {
      background: rgba(255, 255, 255, 0.7);
      border-color: rgba(0, 0, 0, 0.1);
    }
  }

  // 响应式设计
  @media (max-width: 768px) {
    .legend {
      padding: 8px 15px;
      gap: 15px;
      flex-wrap: wrap;

      &.legend-left,
      &.legend-right {
        width: 100%;
        flex-direction: row;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
      }

      .legend-item {
        .legend-name {
          font-size: 11px;
        }
      }
    }
  }

  @media (max-width: 480px) {
    .legend {
      padding: 6px 10px;
      gap: 10px;

      .legend-item {
        .legend-color {
          width: 10px;
          height: 10px;
        }

        .legend-name {
          font-size: 10px;
        }
      }
    }
  }

  // 加载状态
  &.loading {
    .chart-canvas {
      opacity: 0.5;
      pointer-events: none;
    }

    &::after {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 32px;
      height: 32px;
      margin: -16px 0 0 -16px;
      border: 3px solid rgba(255, 255, 255, 0.3);
      border-top-color: #fff;
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }
  }

  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }

  // 无数据状态
  &.no-data {
    .chart-canvas {
      opacity: 0.3;
    }

    &::before {
      content: '暂无数据';
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      color: rgba(255, 255, 255, 0.6);
      font-size: 14px;
      font-weight: 500;
      z-index: 10;
    }
  }

  // 悬停效果
  &:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
    transition: all 0.3s ease;
  }

  // 高对比度模式
  @media (prefers-contrast: high) {
    &.dark {
      background: #000;
      color: #fff;

      .legend {
        background: #000;
        border-color: #fff;
      }
    }

    &.light {
      background: #fff;
      color: #000;

      .legend {
        background: #fff;
        border-color: #000;
      }
    }
  }

  // 减少动画
  @media (prefers-reduced-motion: reduce) {
    &:hover {
      transform: none;
      transition: none;
    }

    .legend-item {
      transition: none;
    }

    &.loading::after {
      animation: none;
    }
  }
}
